package models;

import java.util.*;

import javax.persistence.*;

import play.db.jpa.*;

@Entity
public class Idea extends Model {

	String title;
	@Lob
	String content;
	double rating;
	Date date;
	@OneToMany(mappedBy = "idea", cascade = CascadeType.ALL)
	List<Plan> plans;
	@ManyToMany
	List<User> markers;
	@ManyToMany
	List<User> subscribers;
	@ManyToOne
	Topic topic;
	@ManyToOne
	User creator;
	@ManyToMany
	List<User> raters;
	@OneToMany(mappedBy = "idea", cascade = CascadeType.ALL)
	List<Comment> comments;

	public Idea(String title, String content, double rating, Date date,
			ArrayList<Plan> plans, Topic topic, User creator) {
		this.title = title;
		this.content = content;
		this.rating = rating;
		this.date = date;
		this.plans = plans;
		this.topic = topic;
		this.creator = creator;
		this.markers = new ArrayList<User>();
		this.subscribers = new ArrayList<User>();
		this.raters = new ArrayList<User>();
		this.comments = new ArrayList<Comment>();
	}

}
